<template>
	<div class="w-100% h-100% flex-col">
		<div class="logo">
			<div class="imgs">
				<img src="@/assets/img/logo.png" style="max-width: 420px; max-height: 50px" alt="" />
			</div>
		</div>
		<div class="active w-100% flex-center flex-col">
			<div style="width: 30%">
				<p>激活“{{ TITLE }}”</p>
				<p>您的{{ TITLE }}{{ $store.guarder.pageInfoError }}，请联系经销商重新获取许可证激活系统</p>
			</div>
		</div>
		<div class="content flex-center">
			<div class="flex m-between p-b-10" style="width: 30%">
				<div class="left" style="width: 50%">
					<p>软件信息</p>
					<p>软件名称：{{ TITLE }}</p>
					<p>企业名称：西安润道智检科技有限公司</p>
					<p>联系电话：029-81132953</p>
					<p>联系邮箱：rd@xarundao.com</p>
					<p>单位地址：陕西省西安市高新区西太路526号信息产业园二期4号楼A2-03</p>
				</div>
				<div class="right" style="width: 50%">
					<p class="m-b-10">扫一扫获取请求码</p>
					<div class="flex-center">
						<div class="p-10 orcode">
							<vue-qr logoSrc="/favicon.ico" :logoScale="20" :size="120" :text="codevalue" :margin="0" :dotScale="1" style="vertical-align: top" />
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="bottom flex-auto flex m-center">
			<div class="flex-col" style="width: 30%">
				<p>激活软件</p>
				<p>将请求码发送至经销即可获取许可证</p>
				<div class="flex">
					<el-input type="textarea" resize="none" v-model="code" placeholder="请输入许可证"></el-input>
					<div class="submit flex-center" @click="submit">立即激活</div>
				</div>
			</div>
			<img class="imgs" src="@/assets/img/key.png" alt="" />
		</div>
	</div>
</template>

<script setup name="/512">
import { TITLE } from '@/config';
import { getRandom, postUploadLicense } from '@a/verification';
import vueQr from 'vue-qr/src/packages/vue-qr.vue';

const code = ref(''),
	codevalue = ref('');

getRandom().then((res) => {
	codevalue.value = res.data;
});

function submit() {
	if (!code.value) return msgWarning('请输入许可证');
	postUploadLicense({ machine: code.value }).then(() => {
		$router.push('/login');
	});
}
</script>

<style lang="scss" scoped>
.logo {
	padding: 30px;

	.imgs {
		width: 172px;
		height: 23px;
	}
}

.active {
	box-sizing: border-box;
	padding: 62px 20px;
	background: #f4f7ff;

	p:nth-child(1) {
		margin: 0;
		font-size: 32px;
		font-weight: 900;
		line-height: 40px;
		color: #3a3f62;
	}

	p:nth-child(2) {
		margin: 16px 0 0;
		font-size: 16px;
		font-weight: normal;
		line-height: 24px;
		color: #6a74a5;
	}
}

.content {
	box-sizing: border-box;
	padding: 0 20px;
	font-size: 16px;
	font-weight: normal;
	line-height: 24px;
	color: #3a3f62;

	.left {
		padding-bottom: 20px;
		border-right: 1px solid rgb(230 233 243 / 100%);
		border-bottom: 1px solid rgb(230 233 243 / 100%);

		p:nth-child(1) {
			margin-top: 32px;
			font-weight: bold;
		}
	}

	.right {
		font-weight: bold;
		text-align: center;
		border-bottom: 1px solid rgb(230 233 243 / 100%);

		p {
			margin-top: 32px;
		}

		.orcode {
			background: #fff;
			border-radius: 8px;
			box-shadow: 0 4px 20px 0 rgb(179 192 231 / 30%);
			opacity: 1;
		}
	}
}

.bottom {
	position: relative;
	padding: 0 20px;
	font-size: 16px;
	line-height: 24px;
	color: #3a3f62;

	p:nth-child(1) {
		margin-bottom: 0;
		font-weight: bold;
	}

	p:nth-child(2) {
		margin: 7px 0 18px;
		font-size: 16px;
		color: #6a74a5;
	}

	.imgs {
		position: absolute;
		right: 0;
		bottom: 0;
	}

	:deep(.el-textarea) {
		.el-textarea__inner {
			height: 100%;
			background: #fff;
			border: 1px solid #d8e0ef;
			border-right: 0;
			border-radius: 8px;
			border-top-right-radius: 0;
			border-bottom-right-radius: 0;
			box-shadow: 0 1px 2px 0 rgb(183 200 224 / 22.2%);
			opacity: 1;
		}
	}

	.submit {
		width: 22%;
		font-size: 14px;
		color: var(--system-primary-text-color);
		text-align: center;
		cursor: pointer;
		background: linear-gradient(45deg, #4e89ff 0%, #4a5eff 100%);
		border-radius: 0 8px 8px 0;
		box-shadow: 0 4px 16px 0 #b3c0e7;

		&:hover {
			color: var(--el-color-white);
			background: var(--el-color-primary-light-3);
		}
	}
}
</style>
